﻿namespace NEvoWeb.Modules.NB_Store
{
    using DotNetNuke.Common.Utilities;
    using DotNetNuke.Framework.Providers;
    using Microsoft.ApplicationBlocks.Data;
    using Microsoft.VisualBasic;
    using Microsoft.VisualBasic.CompilerServices;
    using System;
    using System.Data;
    using System.Data.SqlClient;
    using System.Runtime.CompilerServices;
    using System.Runtime.InteropServices;
    using System.Text;
    using System.Web.UI.WebControls;
    using System.Xml;

    public class SqlDataProvider : DataProvider
    {
        private string _connectionString;
        private string _databaseOwner;
        private string _objectQualifier;
        private ProviderConfiguration _providerConfiguration = ProviderConfiguration.GetProviderConfiguration("data");
        private string _providerPath;
        private const string ModuleQualifier = "NEvoWeb_";
        private const string ProviderType = "data";

        public SqlDataProvider()
        {
            Provider provider = (Provider) this._providerConfiguration.Providers[this._providerConfiguration.DefaultProvider];
            this._connectionString = Config.GetConnectionString();
            if (this._connectionString == "")
            {
                this._connectionString = provider.Attributes["connectionString"];
            }
            this._providerPath = provider.Attributes["providerPath"];
            this._objectQualifier = provider.Attributes["objectQualifier"];
            if ((this._objectQualifier != "") & !this._objectQualifier.EndsWith("_"))
            {
                this._objectQualifier = this._objectQualifier + "_";
            }
            this._databaseOwner = provider.Attributes["databaseOwner"];
            if ((this._databaseOwner != "") & !this._databaseOwner.EndsWith("."))
            {
                this._databaseOwner = this._databaseOwner + ".";
            }
        }

        public override int CheckIfProductPurchased(int ProductID, int UserID)
        {
            return Conversions.ToInteger(SqlHelper.ExecuteScalar(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Products_CheckPurchased"), new object[] { ProductID, UserID }));
        }

        public override void ClearCategory(int CategoryID)
        {
            SqlHelper.ExecuteNonQuery(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Categories_Clear"), new object[] { CategoryID });
        }

        public override void ClearDownStore(int PortalID)
        {
            SqlHelper.ExecuteNonQuery(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_ClearDownStore"), new object[] { PortalID });
        }

        public override void ClearNB_Store_SaleRates(int PortalID, int ModelID)
        {
            SqlHelper.ExecuteNonQuery(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_SaleRates_Clear"), new object[] { PortalID, ModelID });
        }

        public override void DeleteNB_Store_Address(int AddressID)
        {
            SqlHelper.ExecuteNonQuery(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Address_Delete"), new object[] { AddressID });
        }

        public override void DeleteNB_Store_Cart(string CartID)
        {
            SqlHelper.ExecuteNonQuery(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Cart_Delete"), new object[] { CartID });
        }

        public override void DeleteNB_Store_CartItems(int ItemID)
        {
            SqlHelper.ExecuteNonQuery(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_CartItems_Delete"), new object[] { ItemID });
        }

        public override void DeleteNB_Store_Categories(int CategoryID)
        {
            SqlHelper.ExecuteNonQuery(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Categories_Delete"), new object[] { CategoryID });
        }

        public override void DeleteNB_Store_Model(int ModelID)
        {
            SqlHelper.ExecuteNonQuery(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Model_Delete"), new object[] { ModelID });
        }

        public override void DeleteNB_Store_Option(int OptionID)
        {
            SqlHelper.ExecuteNonQuery(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Option_Delete"), new object[] { OptionID });
        }

        public override void DeleteNB_Store_OptionValue(int OptionValueID)
        {
            SqlHelper.ExecuteNonQuery(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_OptionValue_Delete"), new object[] { OptionValueID });
        }

        public override void DeleteNB_Store_OrderDetails(int OrderDetailID)
        {
            SqlHelper.ExecuteNonQuery(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_OrderDetails_Delete"), new object[] { OrderDetailID });
        }

        public override void DeleteNB_Store_Orders(int OrderID)
        {
            SqlHelper.ExecuteNonQuery(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Orders_Delete"), new object[] { OrderID });
        }

        public override void DeleteNB_Store_OrderStatus(int OrderStatusID, string Lang)
        {
            SqlHelper.ExecuteNonQuery(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_OrderStatus_Delete"), new object[] { OrderStatusID, Lang });
        }

        public override void DeleteNB_Store_ProductDoc(int DocID)
        {
            SqlHelper.ExecuteNonQuery(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_ProductDoc_Delete"), new object[] { DocID });
        }

        public override void DeleteNB_Store_ProductImage(int ImageID)
        {
            SqlHelper.ExecuteNonQuery(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_ProductImage_Delete"), new object[] { ImageID });
        }

        public override void DeleteNB_Store_ProductRelated(int RelatedID)
        {
            SqlHelper.ExecuteNonQuery(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_ProductRelated_Delete"), new object[] { RelatedID });
        }

        public override void DeleteNB_Store_ProductRelatedByProduct(int ProductID)
        {
            SqlHelper.ExecuteNonQuery(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_ProductRelated_DeleteByProduct"), new object[] { ProductID });
        }

        public override void DeleteNB_Store_Products(int ProductID)
        {
            SqlHelper.ExecuteNonQuery(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Products_Delete"), new object[] { ProductID });
        }

        public override void DeleteNB_Store_Promo(int PromoID)
        {
            SqlHelper.ExecuteNonQuery(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Promo_Delete"), new object[] { PromoID });
        }

        public override void DeleteNB_Store_Reviews(int ReviewID)
        {
            SqlHelper.ExecuteNonQuery(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Reviews_Delete"), new object[] { ReviewID });
        }

        public override void DeleteNB_Store_SaleRates(int ItemID)
        {
            SqlHelper.ExecuteNonQuery(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_SaleRates_Delete"), new object[] { ItemID });
        }

        public override void DeleteNB_Store_Settings(int PortalID, string SettingName, string Lang)
        {
            SqlHelper.ExecuteNonQuery(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Settings_Delete"), new object[] { PortalID, SettingName, Lang });
        }

        public override void DeleteNB_Store_SettingsText(int PortalID, string SettingName, string Lang)
        {
            SqlHelper.ExecuteNonQuery(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_SettingsText_Delete"), new object[] { PortalID, SettingName, Lang });
        }

        public override void DeleteNB_Store_ShippingRates(int ItemId)
        {
            SqlHelper.ExecuteNonQuery(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_ShippingRates_Delete"), new object[] { ItemId });
        }

        public override void DeleteNB_Store_Stock(int StockID)
        {
            SqlHelper.ExecuteNonQuery(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Stock_Delete"), new object[] { StockID });
        }

        public override void DeleteNB_Store_TaxRates(int ItemID)
        {
            SqlHelper.ExecuteNonQuery(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_TaxRates_Delete"), new object[] { ItemID });
        }

        public override void DeleteOldCarts(int PortalID, int CartMins, int OrderMins)
        {
            SqlHelper.ExecuteNonQuery(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Cart_DeleteOldCarts"), new object[] { PortalID, CartMins, OrderMins });
        }

        public override void DeleteProductCategory(int ProductID, int CategoryID)
        {
            SqlHelper.ExecuteNonQuery(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_ProductCategory_Delete"), new object[] { ProductID, CategoryID });
        }

        public override void DeleteShippingMethod(int ShipMethodID)
        {
            SqlHelper.ExecuteNonQuery(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_ShippingMethod_Delete"), new object[] { ShipMethodID });
        }

        public override void DeleteSQLReport(int ReportID)
        {
            SqlHelper.ExecuteNonQuery(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_SQLReport_Delete"), new object[] { ReportID });
        }

        public override void DeleteSQLReportParam(int ReportParamID)
        {
            SqlHelper.ExecuteNonQuery(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_SQLReportParam_Delete"), new object[] { ReportParamID });
        }

        public override void DeleteSQLReportXSL(int ReportXSLID)
        {
            SqlHelper.ExecuteNonQuery(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_SQLReportXSL_Delete"), new object[] { ReportXSLID });
        }

        public override IDataReader ExecuteSQL(string SQLcommand)
        {
            SQLcommand = SQLcommand.Replace("{databaseOwner}", this.DatabaseOwner);
            SQLcommand = SQLcommand.Replace("{objectQualifier}", this.ObjectQualifier);
            return SqlHelper.ExecuteReader(this._connectionString, CommandType.Text, SQLcommand);
        }

        public override string ExecuteSQLReportText(string SQLcommand, string FieldDelimeter, string FieldQualifier, bool ExportHeader)
        {
            IDataReader reader = this.ExecuteSQL(SQLcommand);
            string str2 = "";
            FieldQualifier = Strings.Trim(FieldQualifier);
            FieldDelimeter = Strings.Trim(FieldDelimeter);
            if (reader != null)
            {
                if (ExportHeader)
                {
                    int num3 = reader.FieldCount - 1;
                    for (int i = 0; i <= num3; i++)
                    {
                        str2 = str2 + FieldQualifier + reader.GetName(i).ToString() + FieldQualifier + FieldDelimeter;
                    }
                    str2 = str2.TrimEnd(new char[] { ',' }) + "\r\n";
                }
                while (reader.Read())
                {
                    int num4 = reader.FieldCount - 1;
                    for (int j = 0; j <= num4; j++)
                    {
                        str2 = str2 + FieldQualifier + reader[j].ToString() + FieldQualifier + FieldDelimeter;
                    }
                    str2 = str2.TrimEnd(new char[] { ',' }) + "\r\n";
                }
            }
            return str2;
        }

        public override string ExecuteSQLReportXml(string SQLcommand)
        {
            SqlConnection connection = new SqlConnection(this.ConnectionString);
            connection.Open();
            XmlReader reader = SqlHelper.ExecuteXmlReader(connection, CommandType.Text, SQLcommand);
            StringBuilder builder = new StringBuilder();
            builder.Append("<root>");
            reader.MoveToContent();
            while (reader.Read())
            {
                builder.Append(reader.ReadOuterXml());
            }
            builder.Append("</root>");
            connection.Close();
            return builder.ToString();
        }

        public override int GetCartModelQty(int PortalID, int ModelID, string CartID = "")
        {
            return Conversions.ToInteger(SqlHelper.ExecuteScalar(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Cart_GetModelQty"), new object[] { PortalID, ModelID, CartID }));
        }

        private string GetFullyQualifiedName(string name)
        {
            return (this.DatabaseOwner + this.ObjectQualifier + "NEvoWeb_" + name);
        }

        public override IDataReader GetModelByRef(int ProductID, string ModelRef, string Lang)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Model_GetByRef"), new object[] { ProductID, ModelRef, Lang });
        }

        public override int GetModelInOrders(int ModelID)
        {
            return Conversions.ToInteger(SqlHelper.ExecuteScalar(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Model_GetInOrders"), new object[] { ModelID }));
        }

        public override IDataReader GetNB_Store_Address(int AddressID)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Address_Get"), new object[] { AddressID });
        }

        public override IDataReader GetNB_Store_Cart(string CartID)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Cart_Get"), new object[] { CartID });
        }

        public override IDataReader GetNB_Store_CartItems(int ItemID)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_CartItems_Get"), new object[] { ItemID });
        }

        public override IDataReader GetNB_Store_CartItemsByOptCode(string CartID, string OptCode)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_CartItems_GetByOptCode"), new object[] { CartID, OptCode });
        }

        public override IDataReader GetNB_Store_CartItemss(string CartID)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_CartItems_GetList"), new object[] { CartID });
        }

        public override IDataReader GetNB_Store_CartList(string CartID)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_CartItems_GetCartList"), new object[] { CartID });
        }

        public override IDataReader GetNB_Store_Categories(int CategoryID, string Lang)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Categories_Get"), new object[] { CategoryID, Lang });
        }

        public override IDataReader GetNB_Store_CategoriesList(int PortalID, string Lang, int ParentID, bool Archived, bool IncludeArchived)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Categories_GetList"), new object[] { PortalID, Lang, ParentID, Archived, IncludeArchived });
        }

        public override IDataReader GetNB_Store_DeletedModels(int PortalID)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Model_GetDeletedList"), new object[] { PortalID });
        }

        public override IDataReader GetNB_Store_GetUsers(int PortalID, string Filter)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_GetUsers"), new object[] { PortalID, Filter });
        }

        public override IDataReader GetNB_Store_Model(int ModelID, string Lang)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Model_Get"), new object[] { ModelID, Lang });
        }

        public override IDataReader GetNB_Store_ModelByProductID(int ProductID, string Lang)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Model_GetByProductID"), new object[] { ProductID, Lang });
        }

        public override IDataReader GetNB_Store_Models(int PortalID, int ProductID, string Lang, bool IsDealer)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Model_GetList"), new object[] { PortalID, ProductID, Lang, IsDealer });
        }

        public override IDataReader GetNB_Store_ModelsInStock(int ProductID, string Lang, bool IsDealer)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Model_GetInStockList"), new object[] { ProductID, Lang, IsDealer });
        }

        public override IDataReader GetNB_Store_ModelStockList(int PortalID, string Filter, string Lang, int CategoryID, int PageIndex, int PageSize, bool IsDealer)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Model_GetStockList"), new object[] { PortalID, Filter, Lang, CategoryID, PageIndex, PageSize, IsDealer });
        }

        public override int GetNB_Store_ModelStockListSize(int PortalID, string Filter, string Lang, int CategoryID, bool IsDealer)
        {
            return Conversions.ToInteger(SqlHelper.ExecuteScalar(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Model_GetStockListSize"), new object[] { PortalID, Filter, Lang, CategoryID, IsDealer }));
        }

        public override IDataReader GetNB_Store_Option(int OptionID, string Lang)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Option_Get"), new object[] { OptionID, Lang });
        }

        public override IDataReader GetNB_Store_Options(int ProductID, string Lang)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Option_GetList"), new object[] { ProductID, Lang });
        }

        public override IDataReader GetNB_Store_OptionValue(int OptionValueID, string Lang)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_OptionValue_Get"), new object[] { OptionValueID, Lang });
        }

        public override IDataReader GetNB_Store_OptionValues(int OptionValueID, string Lang)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_OptionValue_GetList"), new object[] { OptionValueID, Lang });
        }

        public override IDataReader GetNB_Store_OrderDetails(int OrderDetailID)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_OrderDetails_Get"), new object[] { OrderDetailID });
        }

        public override IDataReader GetNB_Store_OrderDetailss(int OrderID)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_OrderDetails_GetList"), new object[] { OrderID });
        }

        public override IDataReader GetNB_Store_Orders(int OrderID)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Orders_Get"), new object[] { OrderID });
        }

        public override IDataReader GetNB_Store_OrdersByGUID(string OrderGUID)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Orders_GetByGUID"), new object[] { OrderGUID });
        }

        public override IDataReader GetNB_Store_Orderss(int PortalID, int UsrID, DateTime FromDate, DateTime ToDate, int StatusID, string Filter)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Orders_GetList"), new object[] { PortalID, UsrID, FromDate, ToDate, StatusID, Filter });
        }

        public override IDataReader GetNB_Store_OrderStatus(int OrderStatusID, string Lang)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_OrderStatus_Get"), new object[] { OrderStatusID, Lang });
        }

        public override IDataReader GetNB_Store_OrderStatuss(string Lang)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_OrderStatus_GetList"), new object[] { Lang });
        }

        public override IDataReader GetNB_Store_ProductCategoriesAssigned(int ProductID)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_ProductCategories_GetAssigned"), new object[] { ProductID });
        }

        public override IDataReader GetNB_Store_ProductDoc(int DocID, string Lang)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_ProductDoc_Get"), new object[] { DocID, Lang });
        }

        public override IDataReader GetNB_Store_ProductDocExportList(int PortalID)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_ProductDoc_GetExportList"), new object[] { PortalID });
        }

        public override IDataReader GetNB_Store_ProductDocList(int ProductID, string Lang)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_ProductDoc_GetList"), new object[] { ProductID, Lang });
        }

        public override IDataReader GetNB_Store_ProductImage(int ImageID, string Lang)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_ProductImage_Get"), new object[] { ImageID, Lang });
        }

        public override IDataReader GetNB_Store_ProductImages(int ProductID, string Lang)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_ProductImage_GetList"), new object[] { ProductID, Lang });
        }

        public override IDataReader GetNB_Store_ProductRelated(int RelatedID)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_ProductRelated_Get"), new object[] { RelatedID });
        }

        public override IDataReader GetNB_Store_ProductRelatedList(int PortalID, int ProductID, string Lang, int RelatedType, bool GetAll)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_ProductRelated_GetList"), new object[] { PortalID, ProductID, Lang, RelatedType, GetAll });
        }

        public override IDataReader GetNB_Store_Products(int ProductID, string Lang)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Products_Get"), new object[] { ProductID, Lang });
        }

        public override IDataReader GetNB_Store_ProductSelectDocList(string Lang, string FilterText, int PortalID)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_ProductDoc_GetSelectList"), new object[] { Lang, FilterText, PortalID });
        }

        public override IDataReader GetNB_Store_Productss(int PortalID, int CategoryID, string Lang, string SearchText, bool GetArchived, bool FeaturedOnly, string OrderBY, bool OrderDESC, int ReturnLimit, int PageIndex, int Pagesize, bool SearchDescription, bool isDealer, string CategoryList, bool ExcludeFeatured)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Products_GetList"), new object[] { PortalID, CategoryID, Lang, SearchText, GetArchived, FeaturedOnly, OrderBY, OrderDESC, ReturnLimit, PageIndex, Pagesize, SearchDescription, isDealer, CategoryList, ExcludeFeatured });
        }

        public override IDataReader GetNB_Store_Promo(int PromoID)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Promo_Get"), new object[] { PromoID });
        }

        public override int GetNB_Store_PromoCodeUsage(int PortalID, string PromoCode)
        {
            return Conversions.ToInteger(SqlHelper.ExecuteScalar(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Promo_GetPromoCodeUsage"), new object[] { PortalID, PromoCode }));
        }

        public override IDataReader GetNB_Store_PromoList(int PortalID, string PromoType, string SearchText, bool GetActiveOnly)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Promo_GetList"), new object[] { PortalID, PromoType, SearchText, GetActiveOnly });
        }

        public override IDataReader GetNB_Store_Reviews(int ReviewID)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Reviews_Get"), new object[] { ReviewID });
        }

        public override IDataReader GetNB_Store_Reviewss(int ReviewID)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Reviews_GetList"), new object[] { ReviewID });
        }

        public override IDataReader GetNB_Store_SaleRates(int ItemID)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_SaleRates_Get"), new object[] { ItemID });
        }

        public override IDataReader GetNB_Store_SaleRatesByCacheKey(string CacheKey)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_SaleRates_Get"), new object[] { CacheKey });
        }

        public override IDataReader GetNB_Store_SaleRatesList(int PortalID, int ModelID)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_SaleRates_GetList"), new object[] { PortalID, ModelID });
        }

        public override IDataReader GetNB_Store_Settings(int PortalID, string SettingName, string Lang)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Settings_Get"), new object[] { PortalID, SettingName, Lang });
        }

        public override IDataReader GetNB_Store_Settingss(int PortalID, string Lang, bool IsHost, string SettingName)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Settings_GetList"), new object[] { PortalID, Lang, IsHost, SettingName });
        }

        public override IDataReader GetNB_Store_SettingsText(int PortalID, string SettingName, string Lang)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_SettingsText_Get"), new object[] { PortalID, SettingName, Lang });
        }

        public override IDataReader GetNB_Store_SettingsTexts(int PortalID, string Lang, bool IsHost, string SettingName)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_SettingsText_GetList"), new object[] { PortalID, Lang, IsHost, SettingName });
        }

        public override IDataReader GetNB_Store_ShippingRates(int PortalID, int ItemId)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_ShippingRates_Get"), new object[] { PortalID, ItemId });
        }

        public override IDataReader GetNB_Store_ShippingRatesByObjID(int PortalID, int ObjectId, string ShipType, int ShipMethodID)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_ShippingRates_GetByObjID"), new object[] { PortalID, ObjectId, ShipType, ShipMethodID });
        }

        public override IDataReader GetNB_Store_ShippingRatesListByShipMethodID(int PortalID, int ShipMethodID)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_ShippingRates_GetListByShipMethodID"), new object[] { PortalID, ShipMethodID });
        }

        public override IDataReader GetNB_Store_ShippingRatess(int PortalID, string ShipType, string Lang, string Filter, int CategoryID, int ShipMethodID)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_ShippingRates_GetList"), new object[] { PortalID, ShipType, Lang, Filter, CategoryID, ShipMethodID });
        }

        public override IDataReader GetNB_Store_Stock(int StockID)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Stock_Get"), new object[] { StockID });
        }

        public override IDataReader GetNB_Store_Stocks(int StockID)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Stock_GetList"), new object[] { StockID });
        }

        public override IDataReader GetNB_Store_TaxRates(int PortalID, int ItemID)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_TaxRates_Get"), new object[] { PortalID, ItemID });
        }

        public override IDataReader GetNB_Store_TaxRatesByObjID(int PortalID, int ObjectID, string TaxType)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_TaxRates_GetByObjID"), new object[] { PortalID, ObjectID, TaxType });
        }

        public override IDataReader GetNB_Store_TaxRatess(int PortalID, string TaxType, string Lang, string Filter)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_TaxRates_GetList"), new object[] { PortalID, TaxType, Lang, Filter });
        }

        private object GetNull(object Field)
        {
            return Null.GetNull(RuntimeHelpers.GetObjectValue(Field), DBNull.Value);
        }

        public override IDataReader GetOrdersExportList(int PortalID, int StatusID)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Orders_GetExportList"), new object[] { PortalID, StatusID });
        }

        public override IDataReader GetProductByRef(int PortalID, string ProductRef, string Lang)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Products_GetByRef"), new object[] { PortalID, ProductRef, Lang });
        }

        public override int GetProductCount(int PortalID)
        {
            return Conversions.ToInteger(SqlHelper.ExecuteScalar(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Products_GetCount"), new object[] { PortalID }));
        }

        public override IDataReader GetProductExportImages(int PortalID)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_ProductImage_GetExportList"), new object[] { PortalID });
        }

        public override IDataReader GetProductExportList(int PortalID, string Lang, bool DeletedOnly, string CategoryList)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Products_GetExportList"), new object[] { PortalID, Lang, DeletedOnly, CategoryList });
        }

        public override int GetProductInOrders(int ProductID)
        {
            return Conversions.ToInteger(SqlHelper.ExecuteScalar(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Products_GetInOrders"), new object[] { ProductID }));
        }

        public override int GetProductListSize(int PortalID, int CategoryID, string Lang, string SearchText, bool GetArchived, bool FeaturedOnly, bool SearchDescription, bool isDealer, string CategoryList, bool ExcludeFeatured)
        {
            return Conversions.ToInteger(SqlHelper.ExecuteScalar(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Products_GetListSize"), new object[] { PortalID, CategoryID, Lang, SearchText, GetArchived, FeaturedOnly, SearchDescription, isDealer, CategoryList, ExcludeFeatured }));
        }

        public override IDataReader GetShippingMethod(int ShipMethodID)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_ShippingMethod_Get"), new object[] { ShipMethodID });
        }

        public override IDataReader GetShippingMethodEnabledList(int PortalID)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_ShippingMethod_GetEnabledList"), new object[] { PortalID });
        }

        public override IDataReader GetShippingMethodList(int PortalID)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_ShippingMethod_GetList"), new object[] { PortalID });
        }

        public override IDataReader GetSQLAdminReportList(int PortalID, bool IsEditable, string SearchText)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_SQLReport_GetList"), new object[] { PortalID, IsEditable, SearchText });
        }

        public override IDataReader GetSQLReport(int ReportID)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_SQLReport_Get"), new object[] { ReportID });
        }

        public override IDataReader GetSQLReportByRef(int PortalID, string ReportRef)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_SQLReport_GetByRef"), new object[] { PortalID, ReportRef });
        }

        public override IDataReader GetSQLReportParam(int ReportParamID)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_SQLReportParam_Get"), new object[] { ReportParamID });
        }

        public override IDataReader GetSQLReportParamList(int ReportID)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_SQLReportParam_GetList"), new object[] { ReportID });
        }

        public override IDataReader GetSQLReportXSL(int ReportXSLID)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_SQLReportXSL_Get"), new object[] { ReportXSLID });
        }

        public override IDataReader GetSQLReportXSLList(int ReportID)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_SQLReportXSL_GetList"), new object[] { ReportID });
        }

        public override void NotAvailableProductRelated(int ProductID, bool Flag)
        {
            SqlHelper.ExecuteNonQuery(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_ProductRelated_NotAvailable"), new object[] { ProductID, Flag });
        }

        public override void popDataGridSQL(string SQLcommand, DataGrid GridView)
        {
            SQLcommand = SQLcommand.Replace("{databaseOwner}", this.DatabaseOwner);
            SQLcommand = SQLcommand.Replace("{objectQualifier}", this.ObjectQualifier);
            this.ShowData(SqlHelper.ExecuteReader(this.ConnectionString, CommandType.Text, SQLcommand), GridView);
        }

        public override void ProcessSearchWords(int PortalID)
        {
            SqlHelper.ExecuteNonQuery(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_SearchWords_Process"), new object[] { PortalID });
        }

        public override void PurgeSearchWord(int PortalID, DateTime PurgeBeforeDate)
        {
            SqlHelper.ExecuteNonQuery(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_SearchWords_Purge"), new object[] { PortalID, PurgeBeforeDate });
        }

        private void ShowData(IDataReader MyIDataReader, DataGrid GridView)
        {
            GridView.DataSource = MyIDataReader;
            GridView.DataBind();
        }

        public override IDataReader UpdateNB_Store_Address(int AddressID, int PortalID, int UserID, string AddressDescription, string AddressName, string AddressName2, string Address1, string Address2, string City, string RegionCode, string CountryCode, string PostalCode, string Phone1, string Phone2, bool PrimaryAddress, string CreatedByUser, DateTime CreatedDate, int OrderID, string CompanyName, string Extra1, string Extra2, string Extra3, string Extra4)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Address_Update"), new object[] { 
                AddressID, PortalID, UserID, AddressDescription, AddressName, AddressName2, Address1, Address2, City, RegionCode, CountryCode, PostalCode, Phone1, Phone2, PrimaryAddress, CreatedByUser, 
                CreatedDate, OrderID, CompanyName, Extra1, Extra2, Extra3, Extra4
             });
        }

        public override void UpdateNB_Store_Cart(string CartID, int PortalID, int UserID, DateTime DateCreated, int OrderID, string VATNumber, string PromoCode, string CountryCode, string ShipType, int BankTransID, string BankHtmlRedirect, int ShipMethodID, decimal CartDiscount, string XMLInfo, string Referrer)
        {
            SqlHelper.ExecuteNonQuery(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Cart_Update"), new object[] { CartID, PortalID, UserID, DateCreated, OrderID, VATNumber, PromoCode, CountryCode, ShipType, BankTransID, BankHtmlRedirect, ShipMethodID, CartDiscount, XMLInfo, Referrer });
        }

        public override int UpdateNB_Store_CartItems(int ItemID, string CartID, int Quantity, DateTime DateCreated, decimal UnitCost, int ModelID, string OptCode, string ItemDesc, decimal Discount, decimal Tax, string ProductURL, string XMLInfo, bool StaticAmts)
        {
            return Conversions.ToInteger(SqlHelper.ExecuteScalar(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_CartItems_Update"), new object[] { ItemID, CartID, Quantity, DateCreated, UnitCost, ModelID, OptCode, ItemDesc, Discount, Tax, ProductURL, XMLInfo, StaticAmts }));
        }

        public override IDataReader UpdateNB_Store_Categories(int CategoryID, string Lang, string CategoryName, string CategoryDesc, string Message, int PortalID, bool Archived, string CreatedByUser, DateTime CreatedDate, int ParentCategoryID, int ListOrder, string ProductTemplate, string ListItemTemplate, string ListAltItemTemplate, bool Hide, string ImageURL, string SEOPageTitle, string SEOName, string MetaDescription, string MetaKeywords)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Categories_Update"), new object[] { 
                CategoryID, Lang, CategoryName, CategoryDesc, Message, PortalID, Archived, CreatedByUser, CreatedDate, ParentCategoryID, ListOrder, ProductTemplate, ListItemTemplate, ListAltItemTemplate, Hide, ImageURL, 
                SEOPageTitle, SEOName, MetaDescription, MetaKeywords
             });
        }

        public override int UpdateNB_Store_Model(int ModelID, int ProductID, int ListOrder, decimal UnitCost, string Barcode, string ModelRef, string Lang, string ModelName, int QtyRemaining, int QtyTrans, DateTime QtyTransDate, bool Deleted, int QtyStockSet, decimal DealerCost, decimal PurchaseCost, string XMLData, string Extra, bool DealerOnly, int Allow)
        {
            return Conversions.ToInteger(SqlHelper.ExecuteScalar(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Model_Update"), new object[] { 
                ModelID, ProductID, ListOrder, UnitCost, Barcode, ModelRef, Lang, ModelName, QtyRemaining, QtyTrans, QtyTransDate, Deleted, QtyStockSet, DealerCost, PurchaseCost, XMLData, 
                Extra, DealerOnly, Allow
             }));
        }

        public override IDataReader UpdateNB_Store_Option(int OptionID, int ProductID, int ListOrder, string Lang, string OptionDesc, string Attributes)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Option_Update"), new object[] { OptionID, ProductID, ListOrder, Lang, OptionDesc, Attributes });
        }

        public override int UpdateNB_Store_OptionValue(int OptionValueID, int OptionID, decimal AddedCost, int ListOrder, string Lang, string OptionValueDesc)
        {
            return Conversions.ToInteger(SqlHelper.ExecuteScalar(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_OptionValue_Update"), new object[] { OptionValueID, OptionID, AddedCost, ListOrder, Lang, OptionValueDesc }));
        }

        public override void UpdateNB_Store_OrderDetails(int OrderDetailID, int OrderID, int Quantity, decimal UnitCost, int ModelID, string OptCode, string ItemDesc, decimal Discount, decimal Tax, string ProductURL, decimal PurchaseCost, string CartXMLInfo)
        {
            SqlHelper.ExecuteNonQuery(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_OrderDetails_Update"), new object[] { OrderDetailID, OrderID, Quantity, UnitCost, ModelID, OptCode, ItemDesc, Discount, Tax, ProductURL, PurchaseCost, CartXMLInfo });
        }

        public override IDataReader UpdateNB_Store_Orders(int OrderID, int UserID, int PortalID, string OrderNumber, DateTime OrderDate, DateTime ShipDate, int ShippingAddressID, int BillingAddressID, decimal AppliedTax, decimal ShippingCost, bool OrderIsPlaced, int OrderStatusID, string PayType, decimal CalculatedTax, string NoteMsg, string VATNumber, decimal Discount, string PromoCode, decimal Total, string Email, string BankAuthCode, int ShipMethodID, string TrackingCode, string Stg2FormXML, string Stg3FormXML, decimal AlreadyPaid, string OrderGUID, DateTime ElapsedDate, string GatewayProvider, string CartXMLInfo, string Referrer)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Orders_Update"), new object[] { 
                OrderID, UserID, PortalID, OrderNumber, RuntimeHelpers.GetObjectValue(this.GetNull(OrderDate)), RuntimeHelpers.GetObjectValue(this.GetNull(ShipDate)), ShippingAddressID, BillingAddressID, AppliedTax, ShippingCost, OrderIsPlaced, OrderStatusID, PayType, CalculatedTax, NoteMsg, VATNumber, 
                Discount, PromoCode, Total, Email, BankAuthCode, ShipMethodID, TrackingCode, Stg2FormXML, Stg3FormXML, AlreadyPaid, OrderGUID, RuntimeHelpers.GetObjectValue(this.GetNull(ElapsedDate)), GatewayProvider, CartXMLInfo, Referrer
             });
        }

        public override void UpdateNB_Store_OrderStatus(int OrderStatusID, string Lang, string OrderStatusText, int ListOrder)
        {
            SqlHelper.ExecuteNonQuery(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_OrderStatus_Update"), new object[] { OrderStatusID, Lang, OrderStatusText, ListOrder });
        }

        public override int UpdateNB_Store_ProductDoc(int DocID, int ProductID, string DocPath, int ListOrder, bool Hidden, string FileName, string FileExt, string Lang, string DocDesc)
        {
            return Conversions.ToInteger(SqlHelper.ExecuteScalar(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_ProductDoc_Update"), new object[] { DocID, ProductID, DocPath, ListOrder, Hidden, FileName, FileExt, Lang, DocDesc }));
        }

        public override int UpdateNB_Store_ProductImage(int ImageID, int ProductID, string ImagePath, int ListOrder, bool Hidden, string Lang, string ImageDesc, string ImageURL)
        {
            return Conversions.ToInteger(SqlHelper.ExecuteScalar(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_ProductImage_Update"), new object[] { ImageID, ProductID, ImagePath, ListOrder, Hidden, Lang, ImageDesc, ImageURL }));
        }

        public override void UpdateNB_Store_ProductImageOnly(int ImageID, int ProductID, string ImagePath, int ListOrder, bool Hidden, string ImageURL)
        {
            SqlHelper.ExecuteNonQuery(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_ProductImage_UpdateImageOnly"), new object[] { ImageID, ProductID, ImagePath, ListOrder, Hidden, ImageURL });
        }

        public override int UpdateNB_Store_ProductRelated(int RelatedID, int PortalID, int ProductID, int RelatedProductID, decimal DiscountAmt, decimal DiscountPercent, int ProductQty, int MaxQty, int RelatedType, bool Disabled, bool NotAvailable, bool BiDirectional)
        {
            return Conversions.ToInteger(SqlHelper.ExecuteScalar(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_ProductRelated_Update"), new object[] { RelatedID, PortalID, ProductID, RelatedProductID, DiscountAmt, DiscountPercent, ProductQty, MaxQty, RelatedType, Disabled, NotAvailable, BiDirectional }));
        }

        public override IDataReader UpdateNB_Store_Products(int ProductID, int PortalID, int TaxCategoryID, bool Featured, bool Archived, string CreatedByUser, DateTime CreatedDate, bool IsDeleted, string ProductRef, string Lang, string Summary, string Description, string Manufacturer, string ProductName, string XMLData, string SEOName, string TagWords, bool IsHidden)
        {
            return SqlHelper.ExecuteReader(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Products_Update"), new object[] { 
                ProductID, PortalID, TaxCategoryID, Featured, Archived, CreatedByUser, CreatedDate, IsDeleted, ProductRef, Lang, Summary, Description, Manufacturer, ProductName, XMLData, SEOName, 
                TagWords, IsHidden
             });
        }

        public override void UpdateNB_Store_Promo(int PromoID, int PortalID, int ObjectID, string PromoName, string PromoType, decimal Range1, decimal Range2, DateTime RangeStartDate, DateTime RangeEndDate, string PromoAmount, int PromoPercent, bool Disabled, string PromoCode, string PromoGroup, string PromoUser, int QtyRange1, int QtyRange2, string PromoEmail, string XMLData, int MaxUsagePerUser, int MaxUsage)
        {
            SqlHelper.ExecuteNonQuery(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Promo_Update"), new object[] { 
                PromoID, PortalID, ObjectID, PromoName, PromoType, Range1, Range2, RangeStartDate, RangeEndDate, PromoAmount, PromoPercent, Disabled, PromoCode, PromoGroup, PromoUser, QtyRange1, 
                QtyRange2, PromoEmail, XMLData, MaxUsagePerUser, MaxUsage
             });
        }

        public override void UpdateNB_Store_Reviews(int ReviewID, int PortalID, int ProductID, int UserID, string UserName, int Rating, string Comments, bool Authorized, DateTime CreatedDate)
        {
            SqlHelper.ExecuteNonQuery(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Reviews_Update"), new object[] { ReviewID, PortalID, ProductID, UserID, UserName, Rating, Comments, Authorized, CreatedDate });
        }

        public override void UpdateNB_Store_SaleRates(int ItemID, string CacheKey, int PortalID, string RoleName, int CategoryID, int ModelID, string SalePrice)
        {
            SqlHelper.ExecuteNonQuery(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_SaleRates_Update"), new object[] { ItemID, CacheKey, PortalID, RoleName, CategoryID, ModelID, SalePrice });
        }

        public override void UpdateNB_Store_Settings(int PortalID, string SettingName, string Lang, string SettingValue, bool HostOnly, string GroupRef, string CtrlType)
        {
            SqlHelper.ExecuteNonQuery(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Settings_Update"), new object[] { PortalID, SettingName, Lang, SettingValue, HostOnly, GroupRef, CtrlType });
        }

        public override void UpdateNB_Store_SettingsText(int PortalID, string SettingName, string Lang, string SettingText, bool HostOnly, string GroupRef, string CtrlType)
        {
            SqlHelper.ExecuteNonQuery(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_SettingsText_Update"), new object[] { PortalID, SettingName, Lang, SettingText, HostOnly, GroupRef, CtrlType });
        }

        public override void UpdateNB_Store_ShippingRates(int PortalID, int ItemId, decimal Range1, decimal Range2, int ObjectId, decimal ShipCost, string ShipType, bool Disable, string Description, decimal ProductWeight, decimal ProductHeight, decimal ProductLength, decimal ProductWidth, int ShipMethodID)
        {
            SqlHelper.ExecuteNonQuery(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_ShippingRates_Update"), new object[] { PortalID, ItemId, Range1, Range2, ObjectId, ShipCost, ShipType, Disable, Description, ProductWeight, ProductHeight, ProductLength, ProductWidth, ShipMethodID });
        }

        public override void UpdateNB_Store_Stock(int StockID, int ModelID, int QtyRemaining, int QtyTrans, DateTime QtyTransDate, DateTime ModifiedDate)
        {
            SqlHelper.ExecuteNonQuery(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_Stock_Update"), new object[] { StockID, ModelID, QtyRemaining, QtyTrans, QtyTransDate, ModifiedDate });
        }

        public override void UpdateNB_Store_TaxRates(int PortalID, int ItemID, int ObjectID, string TaxPercent, string TaxDesc, string TaxType, bool Disable)
        {
            SqlHelper.ExecuteNonQuery(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_TaxRates_Update"), new object[] { PortalID, ItemID, ObjectID, TaxPercent, TaxDesc, TaxType, Disable });
        }

        public override void UpdateProductCategory(int ProductID, int CategoryID)
        {
            SqlHelper.ExecuteNonQuery(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_ProductCategory_Update"), new object[] { ProductID, CategoryID });
        }

        public override void UpdateSearchWord(int PortalID, string SearchWord, int WordPosition)
        {
            SqlHelper.ExecuteNonQuery(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_SearchWords_Update"), new object[] { PortalID, SearchWord, WordPosition });
        }

        public override int UpdateShippingMethod(int ShipMethodID, int PortalID, string MethodName, string MethodDesc, int SortOrder, string TemplateName, bool Disabled, string URLtracker)
        {
            return Conversions.ToInteger(SqlHelper.ExecuteScalar(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_ShippingMethod_Update"), new object[] { ShipMethodID, PortalID, MethodName, MethodDesc, SortOrder, TemplateName, Disabled, URLtracker }));
        }

        public override int UpdateSQLReport(int ReportID, int PortalID, string ReportName, string SQL, bool SchedulerFlag, string SchStartHour, string SchStartMins, string SchReRunMins, DateTime LastRunTime, bool AllowExport, bool AllowDisplay, bool DisplayInLine, bool EmailResults, string EmailFrom, string EmailTo, bool ShowSQL, string SQLConnectionString, string ReportRef, bool AllowPaging, string ReportTitle, string FieldDelimeter, string FieldQualifier)
        {
            return Conversions.ToInteger(SqlHelper.ExecuteScalar(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_SQLReport_Update"), new object[] { 
                ReportID, PortalID, ReportName, SQL, SchedulerFlag, SchStartHour, SchStartMins, SchReRunMins, LastRunTime, AllowExport, AllowDisplay, DisplayInLine, EmailResults, EmailFrom, EmailTo, ShowSQL, 
                SQLConnectionString, ReportRef, AllowPaging, ReportTitle, FieldDelimeter, FieldQualifier
             }));
        }

        public override void UpdateSQLReportParam(int ReportParamID, int ReportID, string ParamName, string ParamType, string ParamValue, int ParamSource)
        {
            SqlHelper.ExecuteNonQuery(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_SQLReportParam_Update"), new object[] { ReportParamID, ReportID, ParamName, ParamType, ParamValue, ParamSource });
        }

        public override void UpdateSQLReportXSL(int ReportXSLID, int ReportID, string XMLInput, string XSLFile, string OutputFile, bool DisplayResults, int SortOrder)
        {
            SqlHelper.ExecuteNonQuery(this.ConnectionString, this.GetFullyQualifiedName("NB_Store_SQLReportXSL_Update"), new object[] { ReportXSLID, ReportID, XMLInput, XSLFile, OutputFile, DisplayResults, SortOrder });
        }

        public string ConnectionString
        {
            get
            {
                return this._connectionString;
            }
        }

        public string DatabaseOwner
        {
            get
            {
                return this._databaseOwner;
            }
        }

        public string ObjectQualifier
        {
            get
            {
                return this._objectQualifier;
            }
        }

        public string ProviderPath
        {
            get
            {
                return this._providerPath;
            }
        }
    }
}

